package com.lsm.app.control;

import java.util.List;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lsm.app.service.TestService;

@Controller
@RequestMapping("/common")
public class MyCtrl {
	private static final String CPATH="/common/";
	@Autowired
	private TestService testService;
	@Value(value="${C.hello:hello111}")
	private  String sayword="hello 美女";
	@RequestMapping(value = "/hello", method = RequestMethod.POST)
	public @ResponseBody Object sayName(HttpSession session,HttpServletRequest req,Model model) {
		return testService.test(req.getParameter("grade"));
	}

	@RequestMapping(value = "/hello1", method = RequestMethod.POST)
	public @ResponseBody String sayHello(HttpSession session, HttpServletRequest req,Model model) {
		return sayword;
	}
	@RequestMapping("/login")
	public String login(HttpSession session,HttpServletRequest req,Model model){
		model.addAttribute("T","asdfasdf");
		return CPATH+"index";
	}
}
